var $ = require('../../lib/jquery');
var util = require('./common/util');
var nav = require('./common/nav');
var _header = require('./common/header');
var template = require('../tpl/template');
var minHeight = require('./common/minHeight');
var inputlimit = require('./common/input');
inputlimit.init();
minHeight.init();
var _nav = new nav();
var header = new _header();
if(util.getParam('type')==0){
   getRemind() 
}else{
  getRecord()
}

 function getRemind() { // 获取接种提醒
    util.fetch("api/sun/querySunRemind", {
      childId:util.getParam('childrenid')
    }).then(function(res) {
      var s='';
      $('.js_word').html('接种提醒');
       for (var i=0;i<res.data.length;i++){
        s+='<div class="row df" ><span class="circle"></span><span>'+res.data[i].createTime +'&nbsp;'+ res.data[i].remindTitle + '&nbsp;'+ res.data[i].remindText +'</span></div>'
       }
       $('.js_more').html(s)
    }).fail(function(res) {
     
    })
  }

 function getRecord() { //  获取接种记录
    util.fetch("api/sun/querySunRecord",{
      childId:util.getParam('childrenid'),
      page:1,
      pageSize:50
    }).then(function(res){
      var s='';
       for (var i=0;i<res.data.length;i++){
        s+='<div class="row df" ><span class="circle"></span><span>'+res.data[i].inoculationTime +'&nbsp;'+ res.data[i].recordTitle + '&nbsp;'+res.data[i].recordText+'</span></div>'
       }
       $('.js_more').html(s)
    }).fail(function(res){
     
    })
  }
